:-module(hj,[]).
:-use_module('de.pro').
:-use_module('wx.pro').
:-use_module('tg.pro').
:-use_module('dz.pro').

new(Var,Val):-
	de:new(Var,[count(60),value(Val),type(hj)]).

wuxing(Hj,Wx):-
    new(Hj,A),
	I is A >> 1 << 1,
	S is (I + I mod 6) << 1,
	wx:hongfan(Fw,S),
	Wx = Fw.add(1).

split(H,G,Z):-
	new(H,B),
	C is B mod 10,
	D is B mod 12,
	tg:new(G,C),
	dz:new(Z,D).

de:hj_items(L):-
	de:tg_items(GI),
	de:dz_items(ZI),
	findall(A, (
		    between(0,59,B),
		    C is B mod 10,
		    D is B mod 12,
		    nth0(C,GI,E),
		    nth0(D,ZI,F),
		    atom_concat(E,F,A)
		   ),L).

de:ny_items([
	     海中金,炉中火,大林木,路旁土,剑锋金,山头火,
	     涧下水,城墙土,白腊金,杨柳木,泉中水,屋上土,
	     霹雳火,松柏木,长流水,沙中金,山下火,平地木,
	     壁上土,金箔金,佛灯火,天河水,大驿土,钗钏金,
	     桑松木,大溪水,沙中土,天上火,石榴木,大海水
	     ]).